<script setup lang="ts">
import mpHtml from 'mp-html/src/uni-app/components/mp-html/mp-html.vue'
import { useGeneralDataStore } from '@/store/generalData'

const generalDataStore = useGeneralDataStore()

const content = ref('')

onLoad(async (options) => {
  if (options && options.type) {
    uni.setNavigationBarTitle({ title: options.type })

    content.value = generalDataStore.generalData?.base
      .find(item => item.title === options.type)?.content || ''
  }
  else {
    uni.showToast({ title: '获取失败', icon: 'none' })
  }
})
</script>

<template>
  <mp-html
    :content="content"
    container-style="padding: 30rpx; min-height: 100vh; background-color: #FFFFFF;"
  />
</template>

<route lang="yaml">
name: 'protocol'
layout: 'custom'
</route>
